Scenario #1103: Replace Contact Data

Properties

Required

Given

name value
partnerName Test AG
newContactCaption Test AG - China
newPostalAddress          “department”: “Executive Board”,
         “building”: “Thi Chi Koh Building”,
         “street”: “No.2 Commercial Second Street”,
         “district”: “Niushan Wei Wu”,
         “city”: “Dongguan City”,
         “province”: “Guangdong Province”,
         “country”: “China”
newOfficePhoneNumber ++15 999 654321
newEmailAddress norden@test-ag.example.org

partnerRelationUuid

HTTP GET "/api/hs/office/relations?relationType=PARTNER&personData=Test+AG" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }`
=> status: 200 OK 
[ {
  "uuid" : "d8468486-cc0a-4797-b367-4c393953f190",
  "anchor" : {
    "uuid" : "bb7b76f1-1922-46aa-8c22-468c70c3a9fa", // Person: Hostsharing eG
    "personType" : "LEGAL_PERSON",
    "tradeName" : "Hostsharing eG",
    "salutation" : null,
    "title" : null,
    "givenName" : null,
    "familyName" : null
  },
  "holder" : {
    "uuid" : "1223603d-1a3b-4e0c-a244-027585d22eb2", // Person: Test AG
    "personType" : "LEGAL_PERSON",
    "tradeName" : "Test AG",
    "salutation" : null,
    "title" : null,
    "givenName" : null,
    "familyName" : null
  },
  "type" : "PARTNER",
  "mark" : null,
  "contact" : {
    "uuid" : "72952ade-de15-4718-b66b-bccafd3a59f2", // Contact: Test AG - Hamburg
    "caption" : "Test AG - Hamburg",
    "postalAddress" : {
      "zipcode" : "20123",
      "firm" : "Test AG",
      "country" : "Germany",
      "city" : "Hamburg",
      "street" : "Shanghai-Allee 1",
      "department" : "Geschäftsleitung"
    },
    "emailAddresses" : {
      "main" : "hamburg@test-ag.example.org"
    },
    "phoneNumbers" : {
      "office" : "+49 40 654321-0"
    }
  }
} ]

In production, data this query could result in multiple outputs. In that case, you have to find out which is the right one.

Contact: Test AG - China

HTTP POST "/api/hs/office/contacts" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }` \
  -H 'Content-Type: application/json' \
  --data-binary @- <<EOF
{
  "caption" : "Test AG - China",
  "postalAddress" : {
    "department" : "Executive Board",
    "building" : "Thi Chi Koh Building",
    "street" : "No.2 Commercial Second Street",
    "district" : "Niushan Wei Wu",
    "city" : "Dongguan City",
    "province" : "Guangdong Province",
    "country" : "China"
  },
  "phoneNumbers" : {
    "phone" : "++15 999 654321"
  },
  "emailAddresses" : {
    "main" : "norden@test-ag.example.org"
  }
}
EOF
=> status: 201 CREATED c9fdae44-bedc-4fb6-b5ad-f7016218fc25

Please check first if that contact already exists, if so, use it’s UUID below.

If any postalAddress sub-properties besides those specified in the API (currently firm, name, co, street, zipcode, city, country) its values might not appear in external systems.

Replace the Contact-Reference in the Partner-Relation

HTTP PATCH "/api/hs/office/relations/d8468486-cc0a-4797-b367-4c393953f190" // partnerRelationUuid \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }` \
  -H 'Content-Type: application/json' \
  --data-binary @- <<EOF
{
  "contact.uuid" : "c9fdae44-bedc-4fb6-b5ad-f7016218fc25" // Contact: Test AG - China
}
EOF
=> status: 200 OK 

Verify if the Contact-Relation Got Replaced in the Partner-Relation

HTTP GET "/api/hs/office/relations?relationType=PARTNER&personData=Test+AG" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }`
=> status: 200 OK 
[ {
  "uuid" : "d8468486-cc0a-4797-b367-4c393953f190", // partnerRelationUuid
  "anchor" : {
    "uuid" : "bb7b76f1-1922-46aa-8c22-468c70c3a9fa", // Person: Hostsharing eG
    "personType" : "LEGAL_PERSON",
    "tradeName" : "Hostsharing eG",
    "salutation" : null,
    "title" : null,
    "givenName" : null,
    "familyName" : null
  },
  "holder" : {
    "uuid" : "1223603d-1a3b-4e0c-a244-027585d22eb2", // Person: Test AG
    "personType" : "LEGAL_PERSON",
    "tradeName" : "Test AG",
    "salutation" : null,
    "title" : null,
    "givenName" : null,
    "familyName" : null
  },
  "type" : "PARTNER",
  "mark" : null,
  "contact" : {
    "uuid" : "c9fdae44-bedc-4fb6-b5ad-f7016218fc25", // Contact: Test AG - China
    "caption" : "Test AG - China",
    "postalAddress" : {
      "country" : "China",
      "province" : "Guangdong Province",
      "city" : "Dongguan City",
      "street" : "No.2 Commercial Second Street",
      "district" : "Niushan Wei Wu",
      "department" : "Executive Board",
      "building" : "Thi Chi Koh Building"
    },
    "emailAddresses" : {
      "main" : "norden@test-ag.example.org"
    },
    "phoneNumbers" : {
      "phone" : "++15 999 654321"
    }
  }
} ]

generated on 2026-07-17 01:42:25 for branch